package com.qf.common.oss.config;


import com.aliyun.oss.OSS;
import com.aliyun.oss.OSSClientBuilder;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import javax.annotation.Resource;

/**
 * @author zhangwei
 */
@Configuration
public class OssConfig {
    @Resource
    private OssConfigProperties ossConfigProperties;

    @Bean
    public OSS oss() {
        return new OSSClientBuilder().build(ossConfigProperties.getEndpoint(),
                //
                ossConfigProperties.getAccessKeyId(),
                //
                ossConfigProperties.getSecretAccessKey());
    }
}
